//
//  UIFactory.m
//  SlashEM
//
//  Created by dirk on 1/3/10.
//  Copyright 2010 Dirk Zimmermann. All rights reserved.
//

//  This file is part of Slash'EM.
//
//  Slash'EM is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, version 2 of the License only.
//
//  Slash'EM is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with Slash'EM.  If not, see <http://www.gnu.org/licenses/>.

#import "UIFactory.h"

@implementation UIFactory

+ (UILabel *)messageLabelWithFrame:(CGRect)frame numberOfLines:(int)numberOfLines {
	UILabel *label = [[UILabel alloc] init];
	label.alpha = 1.0f;
	label.userInteractionEnabled = YES;
	label.font = [self messageTextFont];
	label.textColor = [self textColor];
	label.backgroundColor = [self backgroundColor];
	label.numberOfLines = numberOfLines;
	label.frame = frame;
	label.autoresizesSubviews = YES;
	label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
	label.adjustsFontSizeToFitWidth = YES;
	label.minimumFontSize = 6.0f;
	return [label autorelease];
}

+ (UIControl *)buttonWithTitle:(NSString *)title {
	UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
	[button setTitle:title forState:UIControlStateNormal];
	[button sizeToFit];
	return button;
}

+ (float)buttonHeight {
	UIControl *b = [self buttonWithTitle:@"Test"];
	[b sizeToFit];
	return b.bounds.size.height;
}

+ (UIColor *)textColor {
	return [UIColor whiteColor];
}

+ (UIColor *)backgroundColor {
	return [UIColor blackColor];
}

+ (UIColor *)dimmedBackgroundColor {
	return [UIColor darkGrayColor];
}

+ (UIColor *)mapBackgroundColor {
	return [UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:1.0f];
}

+ (UIFont *)messageTextFont {
	return [UIFont fontWithName:@"Arial" size:12.0f];
}

+ (UIFont *)displayTextFont {
	return [UIFont fontWithName:@"Arial" size:11.0f];
}

@end
